// AnsiPage.h: interface for the CAnsiPage class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ANSIPAGE_H__47E833F5_ED1F_4725_98A0_D26AC4A26053__INCLUDED_)
#define AFX_ANSIPAGE_H__47E833F5_ED1F_4725_98A0_D26AC4A26053__INCLUDED_

//#include "EditHistory.h"	// Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CEditHistory;
extern int MAX_COL;
extern int MAX_ROW;

class CAnsiPage  
{
public:
	CAnsiPage();
	~CAnsiPage();
	
public:
	CString GetText(CRect &rect)
	{
		return GetText(rect.left, rect.top, rect.right, rect.bottom);
	}
	CString GetText(int x1, int y1, int x2, int y2);
	void SetModified(BOOL bIsModified);
	BOOL IsModified();
	void SaveCaret();
	CAnsiPage& operator = (const CAnsiPage &rhs);
	CPoint PasteAnsiText(int nCellX, int nCellY, LPCTSTR szAnsiText, BOOL bAddToHistory = FALSE, int nPasteType = PASTE_NORMAL);
	static CSize GetAnsiTextSize(LPCTSTR szAnsiText);
	CString GetDelayAnimateText(CAnsiPage &vPage, CCellInfo& prevcell, int &nTextPos, int nTimingBase, int nMaxLineLen);
	CString GetAnsiText(BOOL bKeepEmptyLine = FALSE)
	{
		return GetAnsiText(0, 0, MAX_COL - 1, MAX_ROW - 1, bKeepEmptyLine);
	}
	CString GetAnsiText(CRect &rect, BOOL bKeepEmptyLine = FALSE)
	{
		return GetAnsiText(rect.left, rect.top, rect.right, rect.bottom, bKeepEmptyLine);
	}
	CString GetAnsiText(int x1, int y1, int x2, int vy2, BOOL bKeepEmptyLine = FALSE);
	CString GetCellsHtml(const CRect &rect);
	CPoint PasteCellsHtml(int nCellX, int nCellY, LPCTSTR szCellsText, BOOL bAddToHistory = FALSE, int nPasteType = PASTE_NORMAL);

	CEditHistory *m_pHistory;
	int m_nTiming;
	CPoint m_ptCaret;
	void Draw(CDC *pDC, CRect &rcBound, BOOL useMemDC = TRUE);
	BOOL SetNewSize(int nNewMaxCol, int nNewMaxRow);
	CCellInfo **m_cells;
	CHAR	  **m_chars;
	CString LeftChar(int row, int col);
	CString RightChar(int row, int col);
	CString TopChar(int row, int col);
	CString BottomChar(int row, int col);
	CString CharAt(int row, int col);
	int GetMaxCol()
	{
		return m_nMaxCol;
	}
	int GetMaxRow()
	{
		return m_nMaxRow;
	}
protected:
	int m_nLastStepCount;
	int m_nMaxCol;
	int m_nMaxRow;
	void Release();
};

#endif // !defined(AFX_ANSIPAGE_H__47E833F5_ED1F_4725_98A0_D26AC4A26053__INCLUDED_)
